package com.tanhua.app.controller;

import cn.hutool.core.map.MapUtil;
import cn.hutool.json.JSONUtil;
import com.tanhua.app.service.SoulService;
import com.tanhua.domain.vo.Answers;
import com.tanhua.domain.vo.AnswersVo;
import org.apache.ibatis.annotations.Mapper;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
public class SoulController {
    @Autowired
    private SoulService soulService;
    @GetMapping(value = "/testSoul",name = "问卷列表")
    public ResponseEntity findSoulTest(){
        return soulService.testSoul();
    }
    @PostMapping(value = "/testSoul",name = "提交问卷")
    public ResponseEntity commitSoulTest(@RequestBody Map map){
        List<Map> anawers = (List<Map>) map.get("answers");
        return soulService.commitSoulTest(anawers);
    }
    @GetMapping(value = "/testSoul/report/{id}",name = "查看结果")
    public ResponseEntity report(@PathVariable String id){
        return soulService.report(id);
    }
}
